CC=g++
CFLAGS=-ggdb -Wall -I /opt/local/include -Wno-deprecated
LIBS=-l pcap -l pthread
MAIN1=main.cpp
MAIN2=log-analyzer.cpp
MAIN3=gnuplot-export.cpp
OUTPUTFILE1=realtime
OUTPUTFILE2=log-analyzer
OUTPUTFILE3=gnuplot-export
COREDEPS=analyzer.o algorithm.o filter.o listener.o logger.o resultsfilter.o session.o util.o
#HEADERFILES=algorithm.h analyzer.h filter.h gnuplotWriter.h gnuplotscript.h listener.h logger.h resultscomparator.h resultsfilter.h session.h sniffex.h trace.h util.h
HEADERFILES=*.h
all: $(OUTPUTFILE1) $(OUTPUTFILE2) $(OUTPUTFILE3)

$(OUTPUTFILE3): $(COREDEPS) gnuplot-export.cpp gnuplotscript.h gnuplotWriter.h 
	$(CC) $(CFLAGS) -o $(OUTPUTFILE3) *.o $(MAIN3) $(LIBS)

$(OUTPUTFILE2): $(COREDEPS) log-analyzer.cpp
	$(CC) $(CFLAGS) -o $(OUTPUTFILE2) *.o $(MAIN2) $(LIBS)

$(OUTPUTFILE1): $(COREDEPS) main.cpp
	$(CC) $(CFLAGS) -o $(OUTPUTFILE1) *.o $(MAIN1) $(LIBS)

analyzer.o: analyzer.cpp $(HEADERFILES)
	$(CC) $(CFLAGS) -c analyzer.cpp 

algorithm.o: algorithm.cpp $(HEADERFILES)
	$(CC) $(CFLAGS) -c algorithm.cpp 

filter.o: filter.cpp $(HEADERFILES)
	$(CC) $(CFLAGS) -c filter.cpp 

listener.o: listener.cpp $(HEADERFILES)
	$(CC) $(CFLAGS) -c listener.cpp

logger.o: logger.cpp $(HEADERFILES)
	$(CC) $(CFLAGS) -c logger.cpp

resultsfilter.o: resultsfilter.cpp $(HEADERFILES)
	$(CC) $(CFLAGS) -c resultsfilter.cpp

session.o: session.cpp $(HEADERFILES)
	$(CC) $(CFLAGS) -c session.cpp

util.o: util.cpp $(HEADERFILES)
	$(CC) $(CFLAGS) -c util.cpp

# Make clean
clean:
	rm -f ./*.o $(OUTPUTFILE1) $(OUTPUTFILE2) $(OUTPUTFILE3) > /dev/null